package com.boot.unity.api.wx.task;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.io.File;

@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class WxCardFileManager {

    @Value("${img.filePath}")
    private String filePath;


    // 进行删除微信报名存放的微信图片
    // @Scheduled(cron = "0 59 23 * * ?")
//    @Scheduled(fixedRate=30*60*1000)
    public void clearWxCardFile(){
        // System.out.println(filePath);
        File file = new File(filePath+"wxfile//");
        File[] files = file.listFiles();
        if (files != null) {
            for (File wjfile : files) {
                wjfile.delete();
            }
        }
    }

}
